#ifndef NNE_DEVICE_CONV_DMA_H_
#define NNE_DEVICE_CONV_DMA_H_

#include "type.h"
#include "util.h"
#include "mem/dram.h"
#include "mem/sram.h"
#include "mem/mem_if.h"
#include <memory>
#define PORT_NUM 2

class ConvDMA{
public:
    ConvDMA(std::shared_ptr<MemInterface> In, std::shared_ptr<MemInterface> Out);
    bool convDmaEn;
    bool vgrEn[PORT_NUM];
    u32 vgrRaddr_l[PORT_NUM];
    u32 vgrRaddr_h[PORT_NUM];
    u32 dramAddrStep[PORT_NUM];
    u32 burstDataLen[PORT_NUM];
    u32 burstDataTimes[PORT_NUM];
    u32 writeDataLen[PORT_NUM];//width after inserting 0
    u32 ramWaddr[PORT_NUM];
    u32 ramWaddr_offset[PORT_NUM];
    u32 ramWaddrStep[PORT_NUM];
    u32 mode[PORT_NUM];
    u32 scale[PORT_NUM];
    u32 padZero[PORT_NUM];//writedatalen * padinter
    u32 irqStatus[PORT_NUM];
    u32 irqMask[PORT_NUM];
    void Run();
    ~ConvDMA();
private:
    u8* DMABuffer;
    std::shared_ptr<MemInterface> InMemPtr;
    std::shared_ptr<MemInterface> OutMemPtr;
};

#endif
